<template>
  <div>
    <div>
      手机号：
      <Input v-model="searchData.mobile" style="width: 150px"></Input>
      城市：
      <Select v-model="searchData.city_id" filterable style="width: 200px">
        <Option :value="val.city_id" v-for="val in cityArr" :key="val.id">{{ val.city_name }}</Option>
      </Select>
      教练：
      <Select v-model="searchData.is_recommend" style="width: 150px">
        <Option :value="0">不推荐</Option>
        <Option :value="1">推荐</Option>
      </Select>
      时间：
      <Date-picker type="daterange" placeholder="开始日期" v-model="searchData.create_time"></Date-picker>
      <Button @click="search" type="primary" icon="ios-search" style="margin-left: 10px;">搜索</Button>
      <Button @click="reset" type="warning" icon="ios-refresh" style="margin-left: 10px;">刷新</Button>
    </div>
    <br>
    <Table :columns="columns" :data="list" border stripe size="small" @on-sort-change="customSort">

    </Table>
    <br>
    <Paginate :total="total" @on-change="changePage" @on-page-size-change="changeSize" :current="searchData.page">
    </Paginate>
  </div>
</template>

<script>
import Paginate from "_c/paginate";
export default {
  name: "verifyCarSell",
  components: {
    Paginate
  },
  data() {
    return {
      searchData: {
        page: 1,
        limit: 10
      },
      // 列表
      columns: [
        {
          title: '订单编号',
          align: 'center',
          key: 'username',
        },
        {
          title: '手机号码',
          align: 'center',
          key: 'mobile',
        },
        {
          title: '套餐名称',
          align: 'center',
          key: 'score',
        },
        {
          title: '支付方式',
          align: 'center',
          key: 'acceptPartnerOrderNum',
        },
        {
          title: '套餐价格',
          align: 'center',
          key: 'partnerOrderTime',
        },
        {
          title: '所在城市',
          align: 'center',
          key: 'partnerIncome',
        },
        {
          title: '购买日期',
          align: 'center',
          key: 'acceptVerifyOrderNum',
        },
        {
          title: '是否过期',
          align: 'center',
          key: 'verifyIncome',
        },
        {
          title: '分享人',
          align: 'center',
          key: 'total',
        },
        {
          title: '分享奖励',
          align: 'center',
          key: 'shareNum',
        },
      ],
      // 数据
      list: [],
      total: 0,
      cityArr: [],
    }
  },
  methods: {
    // 查询管理员信息
    getList() {
      this.$axios('/admin/statistics/income/getList', this.searchData).then(res => {
        this.list = res.data;
        this.total = res.total;
      });
    },
    search() {
      this.searchData.page = 1;
      this.getList();
    },
    reset() {
      this.searchData = {
        page: 1,
        limit: 10,
      };
      this.getList();
    },
    changePage(page) {
      this.searchData.page = page;
      this.getList();
    },
    changeSize(size) {
      this.searchData.limit = size;
      this.getList();
    },
    customSort(column, key, order) {
      this.searchData.order_by = column.key;
      this.searchData.sort = column.order;
      this.getList();
    },
    getOpenCityList() {
      this.$axios("/admin/partner/city/getArr").then(res => {
        this.cityArr = res;
      });
    },
  },
  created() {
    this.getList();
    this.getOpenCityList();
  }
}
</script>
<style></style>
